<?php
/**
 * CompleXml Framework
 *
 * @category   CompleXml
 * @package    CompleXml_Object_Router_Template
 * @copyright  Copyright (c) 2008 Andrey Kucherenko
 * @license    New BSD License
 * @version    $Id: Webpy.php 8 2008-11-13 14:50:42Z kucherenko.andrey $
 */
require_once 'CompleXml/Object/Router.php';

class CompleXml_Object_Router_Template_Webpy extends CompleXml_Object_Router
{

	public function proccess($controllers_dir, $templates_path,  $locale)
	{
		$this->setControllersPath($controllers_dir);
		
		$page = $this->Request->Uri->getString(0, 'index');

		if ($page[0]=='?'){
			$page = 'index';
		}
		
		$action = getenv('REQUEST_METHOD');

		$conroller = ucfirst($page).'Controller';

		$template = $templates_path.DIRECTORY_SEPARATOR.strtolower($page);

		$this->setActions(array($action));
		$this->setTemplate($template);
		$this->setLocale($locale);
		$this->setNeedleOutputHandler();		
		$this->start($conroller);
	}
}
